#ifndef common_typedef_h
#define common_typedef_h

#include <cstdint>

namespace cmn{
#	define chr_cr			10
#	define chr_lf			13
#	define chr_eof			26
#	define BOM				0xfeff;

	typedef uint8_t			byte;
	typedef uint16_t		word;
	typedef uint32_t		dword;
	typedef uint64_t		qword;

	typedef const uint8_t	kbyte;
	typedef const uint16_t	kword;
	typedef const uint32_t	kdword;
	typedef const uint64_t	kqword;

	typedef char*			cstr;
	typedef wchar_t*		cwstr;
	typedef const char*		kcstr;
	typedef const wchar_t*	kcwstr;

	template<class pointer>	inline void safe_release(pointer& obj)	{ if (obj) { obj->release(); obj = nullptr; } }
	template<class pointer>	inline void safe_delete(pointer& ptr)	{ if (ptr) { delete ptr;	ptr = nullptr; } }
	template<class array>	inline void safe_delete_arr(array& arr)	{ if (arr) { delete[] arr;	arr = nullptr; } }
}

#endif	//common_typedef_h
